{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Company:\n",
    "    \n",
    "    # this is will be set for every new instance of our class object.\n",
    "    company_type = 'private'\n",
    "    \n",
    "    # define our constructor\n",
    "    def __init__(self, name, sector, home_country):\n",
    "        self.name = name\n",
    "        self.sector = sector\n",
    "        self.home_country = home_country\n",
    "        self.employee_list = []\n",
    "    \n",
    "    # define our add employee method.\n",
    "    def add_employee(self, employee):\n",
    "        self.employee_list.append(employee)\n",
    "    \n",
    "    # define our employee_count property.\n",
    "    @property\n",
    "    def employee_count(self):\n",
    "        return len(self.employee_list)\n",
    "    \n",
    "class CompanyDivision(Company):\n",
    "    \n",
    "    #\n",
    "    company_type = 'division'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ABC Corp\n",
      "CBA Corp\n",
      "1\n",
      "['Mary Jane']\n",
      "private\n",
      "private\n"
     ]
    }
   ],
   "source": [
    "# create two new instances of our Company Class object\n",
    "comp1 = Company('ABC Corp','Technology','United States')\n",
    "comp2 = Company('CBA Corp','Finance','India')\n",
    "\n",
    "# add and employee to each class\n",
    "comp1.add_employee('Joe Smith')\n",
    "comp2.add_employee('Mary Jane')\n",
    "\n",
    "print(comp1.name)\n",
    "print(comp2.name)\n",
    "\n",
    "print(comp1.employee_count)\n",
    "print(comp2.employee_list)\n",
    "\n",
    "print(comp1.company_type)\n",
    "print(comp2.company_type)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'division'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Div1 = CompanyDivision('Div1', 'Sales', 'United States')\n",
    "Div1.company_type"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
